package com.jvyou.house.service.impl;

import com.jvyou.common.utils.DateUtils;
import com.jvyou.house.domain.HouseComment;
import com.jvyou.house.mapper.HouseCommentMapper;
import com.jvyou.house.service.IHouseCommentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 房屋评论Service业务层处理
 *
 * @author Jvyou
 * @date 2024-09-17
 */
@Service
public class HouseCommentServiceImpl implements IHouseCommentService {
    @Autowired
    private HouseCommentMapper houseCommentMapper;

    /**
     * 查询房屋评论
     *
     * @param id 房屋评论主键
     * @return 房屋评论
     */
    @Override
    public HouseComment selectHouseCommentById(Long id) {
        return houseCommentMapper.selectHouseCommentById(id);
    }

    /**
     * 查询房屋评论列表
     *
     * @param houseComment 房屋评论
     * @return 房屋评论
     */
    @Override
    public List<HouseComment> selectHouseCommentList(HouseComment houseComment) {
        return houseCommentMapper.selectHouseCommentList(houseComment);
    }

    /**
     * 新增房屋评论
     *
     * @param houseComment 房屋评论
     * @return 结果
     */
    @Override
    public int insertHouseComment(HouseComment houseComment) {
        houseComment.setCreateTime(DateUtils.getNowDate());
        return houseCommentMapper.insertHouseComment(houseComment);
    }

    /**
     * 修改房屋评论
     *
     * @param houseComment 房屋评论
     * @return 结果
     */
    @Override
    public int updateHouseComment(HouseComment houseComment) {
        houseComment.setUpdateTime(DateUtils.getNowDate());
        return houseCommentMapper.updateHouseComment(houseComment);
    }

    /**
     * 批量删除房屋评论
     *
     * @param ids 需要删除的房屋评论主键
     * @return 结果
     */
    @Override
    public int deleteHouseCommentByIds(Long[] ids) {
        return houseCommentMapper.deleteHouseCommentByIds(ids);
    }

    /**
     * 删除房屋评论信息
     *
     * @param id 房屋评论主键
     * @return 结果
     */
    @Override
    public int deleteHouseCommentById(Long id) {
        return houseCommentMapper.deleteHouseCommentById(id);
    }
}
